/** @file splat.c
 *
 * @author Nora Tarano <ntarano@andrew.cmu.edu>
 * @author Yuan Meng <yuanm@andrew.cmu.edu>
 * @author Yipeng Yun <yipengy@andrew.cmu.edu>
 *
 * @date Nov 17, 2011
 *
 * @brief Displays a spinning cursor.
 */

#include <unistd.h>

int main(int argc, char** argv)
{
	const char *states = "|/-\\";
	int count = 0;
  
  while(write(STDOUT_FILENO, &states[count], 1) < 1);
  
  // loop through and print each state at a time
  while (1)
  {
    count = (count+1) % 4;
    while(write(STDOUT_FILENO, "\b", 1) < 1);
    while(write(STDOUT_FILENO, &states[count], 1) < 1);
    sleep(200);
  }
  return 0;
}
